import { useHttp } from "./http"
import { useAsync } from "./use-async"
import { useEffect } from "react"
import { cleanObject } from "."
import { User } from "views/project-list/search-panel"

export const useUsers = (param?: Partial<User>) => {
    const client = useHttp()
    const { run, ...result } = useAsync<User[]>()

    useEffect(() => {
        run(client('users',{data: cleanObject(param || {})}))
    },[param])

    return result
}